<?php namespace app\admin\controller;
class Module
{
	protected $class;
	protected $action;

	public function __construct()
	{
		$info = explode('/', $_GET['a']);
		$this->class = 'module\\'.$_GET['m'].'\\'.ucfirst($info[0]);
		$this->action = $info[1];
	}

	public function entry(){
		switch (Request::get('t')) {
			case 'admin':
				$this->admin();
				break;
			case 'web':
				$this->web();
				break;
		}
	}

	//后台访问动作
	public function admin()
	{
		User::isLogin();
		$class=$this->class;
		$obj=new $class;
		$action='admin'.$this->action;
		return $obj->$action();
	}

	//前台访问动作
	public function web(){
		return call_user_func_array( [ new $this->class, 'web' . $this->action ], [ ] );
	}


}